

export const useWebSocketStore = defineStore('websocket', {
  state:() => {
    return {
      status: null,
      data: null,
      ws: null
    }
  },
  getters: {
    getStatus: (state) => state.status,
    getData: (state) => state.data,
    getWs: (state) => state.ws,
  },
  actions: {
    setWs(ws){
      this.ws = ws
    },
    setStatus(status){
      this.status = status
    },
    setData(data){
      this.data = data
    },
    close(){
      this.ws.close();
    },
    send(message){
      this.ws.send(message);
    }
  }
})